<!DOCTYPE html>
<html>

<head lang="en">
    <title>找攻略</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css"/>
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css" />
    <link rel="stylesheet" href="/css/reset.css" />
    <link rel="stylesheet" href="/css/strategyComment.css" />
    <link rel="stylesheet" href="/js/plugins/dialog/dialog.css"/>
    <script src="/js/plugins/jrender/jrender.js"></script>
    <link rel="stylesheet" href="/js/plugins/jquery-confirm/css/jquery-confirm.css">
    <script src="/js/plugins/jquery-confirm/js/jquery-confirm.js"></script>
    <script src="/js/plugins/dialog/dialog.min.js"></script>
    <script src="/js/plugins/hivideo-master/hivideo.js"></script>
    <link rel="stylesheet" href="/js/plugins/hivideo-master/assets/hivideo.css">
    <script src="/js/common.js"></script>
    <style>
        #inputDiv {
            height: 45px;
            width: 100%;
            background-color: #eeeeee;
            position: fixed;
            bottom: 0;
        }
        .submitBtn {
            background-color: #a6b4bc;
            color: white;
            width: 100%;
        }

        /*******************************************************/
        .videoComment .row{
            margin-bottom: 20px;
        }


        .videoComment-date{
            color: #BBBBBB;
            margin-left: 20px;
        }

        .videoComment p,.videoComment span{
            font-size: 13px;
        }



        .videoComment-head img{
            width: 100%;
        }


        @media screen and (max-width: 600px) {
            .videoComment-head img {
                width: 130%;
            }
        }

        .follow{
            font-size: 11px;
            padding: 0px 15px;
            margin-left: 15px;
            background: white;
            border: #787a7d solid 1px;
            float: right;
            color: #46484a;
        }

        .authorName{
            margin: 0px;
        }

        .videoComment-content {
            margin: 0px;
            padding: 0px;
        }
        .videoComment-content p{
            padding: 0px;
            margin: 5px auto 12px ;
        }

        .videoComment,.videoComment-right{
            padding-right: 0px;
        }

        .tab-pane{
            margin-bottom: 50px;
        }

        .icon{
            float: right;font-size: 10px;
            color: #46484a;
            margin-bottom: 10px;
            margin-top: 5px;
        }
        .comment{
            margin-top: 40px;
        }
        .videoComment-list{
            position: fixed;
            overflow-y:scroll; height:300px;
        }
        #msgHead {
            height: 40px;
            width: 100%;
            background-color: #4d4c4b;
            position: fixed;
            top: 0;
        }
    </style>
    <script>
        var id = getParams().id;
        function getComment(){
            $.get("/videos/"+ id + "/comment",{pageSize:0},function (data) {
                console.log(data);
                currentPage = 1;
                pages = data.pages;
                comments = data.list;
                renderViews(data);
            })
        };
        function renderViews(data){
            $(".videoComment-list").renderValues(data,{
                handle:function (ele, value) {
                    ele.href = "/userProfiles.html?id=" + value;
                }
            });
        }
        $(function () {
            $.get("/videos/"+id,function (data) {
                $(".comment").renderValues(data,{
                    handle:function (ele, value) {
                        ele.href = "/userProfiles.html?id=" + value;
                    }
                });
            });
            getComment();
        });
    </script>
</head>

<body>
<div id="msgHead">
    <div class="row nav-search">
        <div class="col-2">
            <a href="javascript:history.go(-1);">
                <span><i class="fa fa-chevron-left"></i></span>
            </a>
        </div>
        <div class="col-7">
            <h5 id="title" style="color: #e9ecef">骡友视频</h5>
        </div>
        <div class="col-3">
        </div>
    </div>
</div>

<div class="comment">
    <div class="videoBox">
        <video  width="100%" height="100%"
                ishivideo="true" autoplay="true" isrotate="false" autoHide="false"
                class="myVideo" render-src="vidUrl">
        </video>
    </div>
    <div class="row">
        <div class="col-2">
            <a href="userProfiles.html"  render-key="user.id" render-fun="handle">
                <img class="rounded-circle" render-src="user.headImgUrl" height="45px">
            </a>
        </div>
        <div class="col-10">
                <h5 render-html="title"></h5>
                简介:<span render-html="subTitle"></span>
        </div>
    </div>
    <hr>
</div>

<div class="videoComment-list">
    <!--快来发表你的评论吧-->
    <div render-loop="list" id="com">
        <div class="container row videoComment">
            <div class="col-2 videoComment-head">
                <a render-key="list.user.id" render-fun="handle">
                    <img class="rounded-circle"
                         render-src="list.user.headImgUrl">
                </a>
            </div>
            <div class="col videoComment-right">
                <p class="authorName"><span render-html="list.user.nickName"></span></p>
                <span class="videoComment-date" render-html="list.time"></span>
                <div class="videoComment-content">
                    <p render-html="list.content"></p>
                </div>
                <div class="d-flex icon">
                    <a >
                        <i class="fa  fa-commenting-o " style="margin-right: 10px"> 评论 </i>
                        <i class="fa fa-thumbs-o-up"> <span>0</span> </i>
                    </a>
                </div>
            </div>
        </div>
    </div>


</div>

<div id="inputDiv">
    <div class="row nav-search">
        <div class="col-9">
            <div class="input-group-sm search">
                <input id="msg" class="form-control searchBtn" placeholder="在这里进行评论哦" style="padding-top: 5px" oninput="change()">
            </div>
        </div>

        <div class="col-3">
            <div class="input-group-sm search">
                <button type="button" class="btn btn-sm badge-pill submitBtn">发表评论</button>
            </div>
        </div>
    </div>
</div>


<div id="push"></div>
</body>
<script>
    var id = getParams().id;
    var user = sessionStorage.getItem("user");
    user = JSON.parse(user);
    $(function () {
        $(".submitBtn").click(function () {
            if (user) {
                var msg = $("#msg").val();
                $("#msg").val("");
                if (msg) {
                    $.post("/videos/" + id + "/comment", {content: msg, "user.id": user.id}, function (data) {
                        if (data.success) {
                            console.log(1);
                            getComment();
                        }
                    })
                } else {

                }
            }else{
                $(document).dialog({
                    type : 'confirm',
                    closeBtnShow: true,
                    content: '想评论,先登录,是否去登录页面??~(￣▽￣)~',
                    onClickConfirmBtn: function(){
                        location.href = "/login.html";
                    }
                });
            }
        });
    })
    function change() {
        if ($("#msg").val()){
            $(".submitBtn").css("background-color","#939dff");
        }else {
            $(".submitBtn").css("background-color","#a6b4bc");
        }
    }
</script>

</html>